home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libg++ / old-stream / PlotFile.h < prev    next >
C/C++ Source or Header  |  1992-01-17  |  4KB  |  150 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988, 1992 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.  
  6. This file is part of the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19. /* 
  20.    a very simple implementation of a class to output unix "plot"
  21.    format plotter files. See corresponding unix man pages for
  22.    more details. 
  23. */
  24.  
  25. #ifndef _PlotFile_h
  26. #ifdef __GNUG__
  27. #pragma interface
  28. #endif
  29. #define _PlotFile_h
  30.  
  31. #include <File.h>
  32.  
  33. /*   
  34.    Some plot libraries have the `box' command to draw boxes. Some don't.
  35.    `box' is included here via moves & lines to allow both possiblilties.
  36. */
  37.  
  38.  
  39. class PlotFile : private File
  40. {
  41. protected:
  42.   PlotFile& cmd(char c);
  43.   PlotFile& operator << (const int x);
  44.   PlotFile& operator << (const char *s);
  45.   
  46. public:
  47.   
  48.   PlotFile();
  49.   PlotFile(const char* filename);
  50.   PlotFile(const char* filename, io_mode m, access_mode a);
  51.   PlotFile(const char* filename, const char* m);
  52.   PlotFile(int filedesc, const io_mode m = io_writeonly);
  53.   PlotFile(FILE* fileptr);
  54.   
  55.   ~PlotFile();
  56.   
  57.   operator void*();
  58.   
  59.   PlotFile& close() { File::close(); return *this; }
  60.   PlotFile& remove() { File::remove(); return *this; }
  61.   
  62.   int           filedesc() { return File::filedesc(); }
  63.   const char*   name() { return File::name(); }
  64.   void          setname(const char* newname) { File::setname(newname); }
  65.   int           iocount() { return File::iocount(); }
  66.   
  67.   int           rdstate() { return File::rdstate(); }
  68.   int           eof() { return File::eof(); }
  69.   int           fail() { return File::fail(); }
  70.   int           bad() { return File::bad(); }
  71.   int           good() { return File::good(); }
  72.   
  73.   // other status queries
  74.   
  75.   int           readable() { return File::readable(); }
  76.   int           writable() { return File::writable(); }
  77.   int           is_open() { return File::is_open(); }
  78.   
  79.   void          error() {  File::error(); }
  80.   void          clear(state_value f = _good) {  File::clear(f); }
  81.   void          set(state_value f) { File::set(f); }
  82.   void          unset(state_value f) { File::unset(f); }
  83.   PlotFile&     failif(int cond) {  File::failif(cond); return *this; }
  84.   void          check_state() { File::check_state(); }
  85.   
  86.   PlotFile&     raw() { File::raw(); return *this; }
  87.   
  88.   PlotFile& open(const char* filename, io_mode m, access_mode a);
  89.   PlotFile& open(const char* filename, const char* m);
  90.   PlotFile& open(int  filedesc,  io_mode m);
  91.   PlotFile& open(FILE* fileptr);
  92.   PlotFile& setbuf(const int buffer_kind); // vals: _IONBF, _IOFBF, _IOLBF
  93.   PlotFile& setbuf(const int size, char* buf);
  94.   
  95.   PlotFile& arc(const int xi, const int yi,
  96.                 const int x0, const int y0,
  97.                 const int x1, const int y1);
  98.   PlotFile& box(const int x0, const int y0,
  99.                 const int x1, const int y1);
  100.   PlotFile& circle(const int x, const int y, const int r);
  101.   PlotFile& cont(const int xi, const int yi);
  102.   PlotFile& dot(const int xi, const int yi, const int dx,
  103.                 int n, const int* pat);
  104.   PlotFile& erase(); 
  105.   PlotFile& label(const char* s);
  106.   PlotFile& line(const int x0, const int y0,
  107.                  const int x1, const int y1);
  108.   PlotFile& linemod(const char* s);
  109.   PlotFile& move(const int xi, const int yi);
  110.   PlotFile& point(const int xi, const int yi);
  111.   PlotFile& space(const int x0, const int y0,
  112.                   const int x1, const int y1);
  113. };
  114.  
  115.  
  116. #endif
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.